home *** CD-ROM | disk | FTP | other *** search
- onClipEvent(load){
- function change_txt(x_num)
- {
- var _loc2_ = "";
- if(x_num < 0)
- {
- _loc2_ = "-";
- x_num = Math.abs(x_num);
- }
- if(x_num > 1000)
- {
- _loc2_ = Math.floor(x_num / 1000) + ",";
- if(x_num % 1000 < 100)
- {
- _loc2_ += "0";
- if(x_num % 1000 < 10)
- {
- _loc2_ += "0" + x_num % 1000;
- }
- else
- {
- _loc2_ += x_num % 1000;
- }
- }
- else
- {
- _loc2_ += x_num % 1000;
- }
- _loc2_ += " km";
- }
- else
- {
- _loc2_ = x_num + " km";
- }
- return _loc2_;
- }
- function load_xml()
- {
- if(n_name != undefined && n_name != "")
- {
- if(country == undefined)
- {
- country = "";
- }
- sch_xml.load("http://www.foxinternational.com/garfield2/soccergame/GarfieldGame.php?name=" + escape(n_name) + "&country=" + escape(country) + "&score=" + la_score);
- start_wait();
- this.gotoAndStop(2);
- }
- }
- function start_wait()
- {
- timer = setInterval(go_wait,10000,this);
- }
- function go_wait(obj)
- {
- stop_wait();
- if(!loaded)
- {
- obj.gotoAndStop(4);
- }
- }
- function stop_wait()
- {
- clearInterval(timer);
- }
- function loadschs(success)
- {
- if(success == true)
- {
- if(sch_xml.firstChild.childNodes.length == 0)
- {
- this.gotoAndStop(4);
- loaded = false;
- }
- else
- {
- var _loc2_ = 0;
- while(_loc2_ < sch_xml.firstChild.childNodes.length)
- {
- if(Number(sch_xml.firstChild.childNodes[_loc2_].attributes.score) >= 80000)
- {
- score_ray.push({xname:sch_xml.firstChild.childNodes[_loc2_].attributes.name,score:80000,country:sch_xml.firstChild.childNodes[_loc2_].attributes.country,timestamp:Number(sch_xml.firstChild.childNodes[_loc2_].attributes.timestamp)});
- }
- else
- {
- score_ray.push({xname:sch_xml.firstChild.childNodes[_loc2_].attributes.name,score:Number(sch_xml.firstChild.childNodes[_loc2_].attributes.score),country:sch_xml.firstChild.childNodes[_loc2_].attributes.country,timestamp:Number(sch_xml.firstChild.childNodes[_loc2_].attributes.timestamp)});
- }
- _loc2_ = _loc2_ + 1;
- }
- score_ray.sortOn(["score","timestamp"],[Array.DESCENDING | Array.NUMERIC,Array.DESCENDING | Array.NUMERIC]);
- loaded = true;
- gotoAndStop(3);
- }
- stop_wait();
- }
- }
- function load_data(x_num1)
- {
- if(last_on >= 0)
- {
- eval("nav" + last_on).gotoAndStop(1);
- }
- last_on = x_num1;
- eval("nav" + last_on).gotoAndStop(3);
- var i = 0;
- while(i <= 19)
- {
- eval("score_" + i).idnum = i + x_num1 + 1;
- eval("score_" + i).n_name = score_ray[i + x_num1].xname;
- eval("score_" + i).la_num = score_ray[i + x_num1].score;
- eval("score_" + i).country = score_ray[i + x_num1].country;
- if(eval("score_" + i).n_name == undefined)
- {
- eval("score_" + i).n_name = "";
- eval("score_" + i).k_txt = "";
- eval("score_" + i).country = "";
- eval("score_" + i).la_num = 0;
- eval("score_" + i)._visible = 0;
- }
- else
- {
- eval("score_" + i)._visible = 1;
- }
- eval("score_" + i).k_txt = change_txt(eval("score_" + i).la_num);
- if(eval("score_" + i).la_num >= 80000)
- {
- eval("score_" + i).gotoAndStop(2);
- }
- else
- {
- eval("score_" + i).gotoAndStop(1);
- }
- i++;
- }
- if(x_num1 != 0)
- {
- prev_btn._visible = 1;
- }
- else
- {
- prev_btn._visible = 0;
- }
- if(x_num1 + 10 >= score_ray.length)
- {
- next_btn._visible = 0;
- }
- else
- {
- next_btn._visible = 1;
- }
- }
- var la_score = Math.round(_parent.score * 80 / 21);
- var la_num = la_score;
- if(la_score > 80000)
- {
- score_txt = "YOU HAVE GONE AROUND THE WORLD!";
- }
- else
- {
- score_txt = "YOUR SCORE IS " + change_txt(la_num) + ".";
- }
- var sch_xml = new XML();
- sch_xml.onLoad = loadschs;
- sch_xml.ignoreWhite = true;
- var loaded = false;
- var timer = -1;
- var score_ray = new Array();
- var last_on = -1;
- }
-